package com.cuxiaoyi.action;

import com.cuxiaoyi.db.Dao;
import com.cuxiaoyi.model.User;
import com.cuxiaoyi.utils.PagingOption;
import com.cuxiaoyi.utils.PagingResult;
import com.opensymphony.xwork2.ActionSupport;

public class UsersAction extends ActionSupport {

	private PagingOption option;
	private PagingResult<User> users;
	
	public String execute() throws Exception {
		System.out.println("ooooooooooooooooooption: " + getOption());
		if (option == null)
		{
			option = new PagingOption();
			option.setLimit(30);
		}
		users = Dao.INSTANCE.getUsers(getOption());	
		return SUCCESS;
	}
	
	public PagingResult<User> getUsers()
	{
		return users;
	}

	public void setOption(PagingOption option) {
		this.option = option;
	}

	public PagingOption getOption() {
		return option;
	}
}
